﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GeekShop.Commands;
using System.Drawing;

namespace GeekShop.Tools.ColorPicker
{
    public class Gradient : MouseBehaviour, ITool
    {
        #region Fields
        private ICommand command = null;
        #endregion

        #region Properties
        public System.Windows.Forms.Cursor Cursor
        {
            get { return Cursors.IBeam; }
        }
        public System.Drawing.Bitmap Icon
        {
            get 
            {
                GeekShop.Gradient gradient = GradientColorDialog.Form.Gradient;
                Bitmap icon = (Bitmap)GeekShop.Properties.Resources.color_gradient.Clone();
                Graphics g = Graphics.FromImage(icon);
                for (int i = 0; i < 14; i++)
                {
                    g.DrawLine(new Pen(gradient.getColor((double)i / 13)), i + 4, 4, i + 4, 16);
                }
                return icon;
            }
        }
        public string Name
        {
            get { return "Color Gradient"; }
        }
        public ICommand Command { get { return this.command; } }
        #endregion

        #region Methods

        /// <summary>
        /// Creates an instance of the GradientColorDialog.
        /// </summary>
        /// <param name="Target"></param>
        /// <returns></returns>
        public void RunDialog(PictureManager pictureManager)
        {
            GeekShop.Gradient oldGradient = GradientColorDialog.Form.Gradient.Clone();
            if (GradientColorDialog.Form.RunDialog() != DialogResult.OK)
            {
                GradientColorDialog.Form.Gradient = oldGradient;
            }
        }
        #endregion

        #region Events
        public event EventHandler ToolReady;
        #endregion

        #region Event Methods
        public override void MouseMove(object sender, MouseEventArgs e)
        {
            
        }
        public override void MouseUp(object sender, MouseEventArgs e)
        {
            
        }
        #endregion
    }
}
